package com.sunseagear.wind.modules.sys.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sunseagear.common.base.mvc.entity.TreeEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Data
@TableName("sys_menu")
@SuppressWarnings("serial")
public class Menu extends TreeEntity<Long> {

    public static final String CATALOG = "1";
    public static final String MENU = "2";
    public static final String BUTTON = "3";

    public static final String YES = "1";
    public static final String FALSE = "0";

    /**
     * 主键id
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 名称
     */
    @TableField(value = "name")
    protected String name;

    /**
     * 权限
     */
    @TableField(value = "permission")
    private String permission;

    /**
     * 菜单类型
     */
    @TableField(value = "type")
    private String type;

    /**
     * 路径编码
     */
    @TableField(value = "path")
    private String path;

    /**
     * 是否显示
     */
    @TableField(value = "enabled")
    private String enabled;

    /**
     * 显示卡片
     */
    @TableField(value = "card")
    private String card;

    /**
     * 排序
     */
    @TableField(value = "sort")
    private Integer sort;

    /**
     * 图标
     */
    @TableField(value = "icon")
    private String icon;

    /**
     * 是否缓存
     */
    @TableField(value = "is_cache")
    private Boolean isCache;

    /**
     * 前端资源路径
     */
    @TableField(value = "component")
    private String component;


    public Boolean isEnable() {
        return YES.equals(enabled);
    }

}
